From: Marco Trevisan (TreviƱo) Date: Tue, 26 Aug 2025 14:40:07 +0000 (+0200) Subject: gdm/authPrompt: Factorize the entry update code X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~104^2^2~11 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=e3f8f8d727c10c669b32335754a43b45219ec6c7;p=gnome-shell.git gdm/authPrompt: Factorize the entry update code Cleanup the code a bit to make future updates smaller Part-of: --- diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index d7e94000d..b6fdb65e9 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -293,15 +293,22 @@ export const AuthPrompt = GObject.registerClass({ } _updateEntry(secret) { + let newEntry, inactiveEntry; + if (secret && this._entry !== this._passwordEntry) { - this._mainBox.replace_child(this._entry, this._passwordEntry); - this._entry = this._passwordEntry; - this._inactiveEntry = this._textEntry; + newEntry = this._passwordEntry; + inactiveEntry = this._textEntry; } else if (!secret && this._entry !== this._textEntry) { - this._mainBox.replace_child(this._entry, this._textEntry); - this._entry = this._textEntry; - this._inactiveEntry = this._passwordEntry; + newEntry = this._textEntry; + inactiveEntry = this._passwordEntry; + } + + if (newEntry) { + this._mainBox.replace_child(this._entry, newEntry); + this._entry = newEntry; + this._inactiveEntry = inactiveEntry; } + this._capsLockWarningLabel.visible = secret; }